<html xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout" layout:decorator="base/layout.html">

    <!-- start: Content -->
    <div layout:fragment="content" class="main sidebar-minified">

        <div class="row">
            <div class="col-lg-12">
                <ol class="breadcrumb">
                    <li><i class="fa fa-home"></i><a href="index.html">首页</a></li>
                    <li><i class="fa fa-table"></i>用户信息管理</li>
                </ol>
            </div>
        </div>
        <div class="row">


            <div class="col-lg-3 col-sm-6 col-xs-6 col-xxs-12">
                <div class="smallstat teal-bg">
                    <i class="fa fa-bell white-bg"></i>
                    <a  th:href="@{../userInfo/toUserInfoAdd}"><span class="value black">添加用户信息</span></a>
                    <span  class="title">用来添加用户信息</span>
                </div><!--/.smallstat-->
            </div><!--/.col-->

        </div>

        <div class="row">
            <div class="col-lg-12">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h2><i class="fa fa-table red"></i><span class="break"></span><strong>用户信息管理</strong></h2>
                        <div class="panel-actions">
                            <a href="table.html#" class="btn-setting"><i class="fa fa-rotate-right"></i></a>
                            <a href="table.html#" class="btn-minimize"><i class="fa fa-chevron-up"></i></a>
                            <a href="table.html#" class="btn-close"><i class="fa fa-times"></i></a>
                        </div>
                    </div>
                    <div class="panel-body">
                        <table class="table table-striped table-bordered bootstrap-datatable datatable">
                            <thead>
                            <tr>
                                <th>序号</th>
                                <th>部门</th>
                                <th>用户账户</th>

                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>



                                <tr th:each="userInfo,state  : ${userInfoList}">
                                    <td th:text="${state.index+1}"></td>
                                    <td th:if="${#lists.isEmpty(userInfo.department)}"></td>
                                    <td th:unless="${#lists.isEmpty(userInfo.department)}" th:text="${userInfo.department.department}"></td>
                                    <td th:text="${userInfo.name}"></td>


                                    <td>

                                        <a class="btn btn-info"th:onclick="'layerOpen(\'toResetPassword?id='+${userInfo.id}+'\')'">
                                            <i class="fa fa-edit "></i>
                                        </a>
                                        <a class="btn btn-danger" th:onclick="'deleteUserInfo('+${userInfo.id}+')'">
                                            <i class="fa fa-trash-o "></i>

                                        </a>
                                    </td>

                                </tr>








                            </tbody>
                        </table>
                        <!-- 分页 -->
                        <div th:unless="${#lists.isEmpty(userInfoList)}">

                            <div

                                    th:replace="base/pagination :: pagination('queryUserInfo')"></div>
                        </div>

                    </div>
                </div>
            </div><!--/col-->

        </div><!--/row-->



        <script>
            function deleteUserInfo(id) {

                layer.confirm('确认删除？', {
                    btn: ['确认','取消'] //按钮
                }, function(index){
                    //确认
                    //首先关闭弹窗
                    layer.close(index);

                    $.ajax({
                        url:'deleteUserInfo',
                        type:'get',
                        data:'id='+id,
                        success:function () {

                            layer.msg("删除成功!");
                            location.reload();
                        }
                    })



                }, function(){
                    //取消

                });



            }




        </script>




    </div>
    <!-- end: Content -->






